package com.techsen.tsweb.sys.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.techsen.tsweb.core.domain.BaseEntity;
import com.techsen.tsweb.sys.security.AclPermission;

/**
 * 访问控制列表
 */
public class Acl extends BaseEntity<Acl> {

    private static final long serialVersionUID = 48413348353873912L;
    
    /**
     * 主体类型
     */
    private String principalType;
    
    /**
     * 主体类型描述
     */
    private String principalTypeDesc;
    
    /**
     * 主体Id
     */
    private String principalId;
    
    /**
     * 资源类型
     */
    private String resourceType;
    
    /**
     * 资源类型描述
     */
    private String resourceTypeDesc;
    
    /**
     * 资源组
     */
    private String resourceGroup;
    
    /**
     * 访问控制码
     */
    private Integer aclCode;
    
    @JsonIgnore
    public AclPermission getAclPermission() {
        return new AclPermission(resourceType, resourceGroup, aclCode);
    }
    
    public String getPrincipalType() {
        return principalType;
    }

    public Acl setPrincipalType(String principalType) {
        this.principalType = principalType;
        return this;
    }

    public String getPrincipalTypeDesc() {
        return principalTypeDesc;
    }

    public Acl setPrincipalTypeDesc(String principalTypeDesc) {
        this.principalTypeDesc = principalTypeDesc;
        return this;
    }

    public String getPrincipalId() {
        return principalId;
    }

    public Acl setPrincipalId(String principalId) {
        this.principalId = principalId;
        return this;
    }

    public String getResourceType() {
        return resourceType;
    }

    public Acl setResourceType(String resourceType) {
        this.resourceType = resourceType;
        return this;
    }

    public String getResourceTypeDesc() {
        return resourceTypeDesc;
    }

    public Acl setResourceTypeDesc(String resourceTypeDesc) {
        this.resourceTypeDesc = resourceTypeDesc;
        return this;
    }

    public String getResourceGroup() {
        return resourceGroup;
    }

    public Acl setResourceGroup(String resourceGroup) {
        this.resourceGroup = resourceGroup;
        return this;
    }

    public Integer getAclCode() {
        return aclCode;
    }

    public Acl setAclCode(Integer aclCode) {
        this.aclCode = aclCode;
        return this;
    }

}
